
import { id } from "element-plus/es/locale";
import { IfromDate } from "../pages/ums/type";
import instance from "./request";

// 登录参数
interface IloginParam{
    password:string,
    username:string
}
// 后台用户管理
export const loginAPI =(data:IloginParam):dataAPI<ILoginData> => instance.post('/admin/login',data)

// 获取当前登录用户信息
export const getAdminInfoAPI =():dataAPI<adminInfoDate> => instance.get('/admin/info')

// 退出登录
export const LogoutAPI =()=>instance.post('/admin/logout')


// 根据用户名或姓名分页获取用户列表
interface IAdminListParam {
    keyword?:string,
    pageNum?:number,
    pageSize?:number
}
export const getAdminListAPI =(params:IAdminListParam):dataAPI<AdminListDate>=>instance.get('/admin/list',{params})

//  修改帐号状态
export const getAdminUpdateStatusAPI  =(id:number,status:number):dataAPI<string>=>instance.post(`/admin/updateStatus/${id}?status=${status}`)


export const adminUpdateAPi =(id:number,data:IfromDate):dataAPI<string>=>instance.post('/admin/update/'+id,data)










// 后台用户角色管理
// 根据角色名称分页获取角色列表
export const getRoleListAPI =(params:IAdminListParam):dataAPI<RoleListDate>=> instance.get('/role/list',{params})